const mongoose = require('mongoose');
const { maindb } = require('../utils/db.js')
const Schema = mongoose.Schema;

const sensitiveWordSchema = new Schema({
    word: { // 敏感词
        type: String,
        required: true,
        unique: true,
        index: true
    },
    triggerCount: { // 触发次数
        type: Number,
        default: 0,
        index: true
    },
    status: { // 状态
        type: Number,
        default: 0, // 0正常，1禁用
        index: true
    },
    createdAt: { // 创建时间
        type: Date,
        default: Date.now,
        index: true
    },
    updatedAt: { // 更新时间
        type: Date,
        default: Date.now
    }
});

const SensitiveWord = maindb.model('SensitiveWord', sensitiveWordSchema);

module.exports = { SensitiveWord };